<div class="pageContent">
	
	<form method="post" action="/index.php?act=visitafter&st=visitEdit" class="pageForm required-validate" onsubmit="return validateCallback(this, dialogAjaxDone)">
		<input type="hidden" name="id" value="{$id}" />
		<div class="pageFormContent" layoutH="58">

			<p>
				<label>客户名称：</label>
				<input name="a[customer_name]" type="text" size="30" class="required" errormsg="请输入客户名称" value="{$visit.info.customer_name}"/>
			</p>
			<p>
				<label>所在省份：</label>
				<input name="a[province]" type="text" size="30" class="required" errormsg="请输入客户所在省份" value="{$visit.info.province}"/>
			</p>
			<p>
				<label>所在城市：</label>
				<input name="a[city]" type="text" size="30" class="required" errormsg="请输入客户所在城市" value="{$visit.info.city}"/>
			</p>
			<p>
				<label>所在区县：</label>
				<input name="a[area]" type="text" size="30" class="required" errormsg="请输入客户所在区县" value="{$visit.info.area}"/>
			</p>
			<p>
				<label>所在街道：</label>
				<input name="a[street]" type="text" size="30" class="required" errormsg="请输入客户所在街道" value="{$visit.info.street}"/>
			</p>
			<p>
				<label>业务所属部门：</label>
				<input name="a[part]" type="text" size="30" class="required" errormsg="请输入业务所属部门" value="{$visit.info.part}"/>
			</p>
			<p>
				<label>维护业务人员：</label>
				<input name="a[sale_name]" type="text" size="30" class="required" errormsg="请输入维护业务人员" value="{$visit.info.sale_name}"/>
			</p>
			<p>
				<label>收集月用户状态：</label>
				<input name="a[status]" type="text" size="30" class="required" errormsg="请输入月用户状态" value="{$visit.info.status}"/>
			</p>
			<div class="unit">
				<label>企业概况：</label>
				<textarea name="a[general]" rows="10" cols="100" class="required" errormsg="请输入企业概况">{$visit.info.general}</textarea>
			</div>
			<div class="unit">
				<label>用户拿货能力：</label>
				<textarea name="a[ability]" rows="10" cols="100" class="required" errormsg="请输入用户拿货能力">{$visit.info.ability}</textarea>
			</div>
			<div class="divider"></div>

			<p>
				<label>问题收集人姓名：</label>
				<input name="b[collection_name]" type="text" size="30" class="required" errormsg="请输入问题收集人姓名" value="{$visit.info.collection_name}"/>
			</p>
			<p>
				<label>问题收集人部门：</label>
				<input name="b[collection_part]" type="text" size="30" class="required" errormsg="请输入问题收集人部门" value="{$visit.info.collection_part}"/>
			</p>
			<p>
				<label>问题收集人电话：</label>
				<input name="b[collection_tel]" type="text" size="30" class="required" errormsg="请输入问题收集人电话" value="{$visit.info.collection_tel}"/>
			</p>
			<p>
				<label>问题收集人职务：</label>
				<input name="b[collection_study]" type="text" size="30" class="required" errormsg="请输入问题收集人职务" value="{$visit.info.collection_study}"/>
			</p>
			<p>
				<label>问题收集渠道：</label>
				<input name="b[collection_channel]" type="text" size="30" class="required" errormsg="请输入问题收集渠道" value="{$visit.info.collection_channel}"/>
			</p>
			<p>
				<label>问题收集日期：</label>
				<input type="text" name="b[collection_date]" class="date required" errormsg="请输入问题收集日期" size="30" dateFmt="yyyy-MM-dd HH:mm:ss" readonly="true" value="{$visit.info.collection_date}"/><a class="inputDateButton" href="javascript:;">选择</a>
			</p>
			<div class="divider"></div>
			<p>
				<label>涉及合同：</label>
				<input name="b[agreement]" type="text" size="30" errormsg="请输入涉及合同" value="{$visit.info.agreement}"/>
			</p>
			<p>
				<label>涉及产品：</label>
				<input name="b[product]" type="text" size="30" errormsg="请输入涉及产品" value="{$visit.info.product}"/>
			</p>
			<p>
				<label>涉及牌号：</label>
				<input name="b[grade]" type="text" size="30"  errormsg="请输入涉及牌号" value="{$visit.info.grade}"/>
			</p>
			<p>
				<label>涉及规格：</label>
				<input name="b[format]" type="text" size="30" errormsg="请输入涉及规格" value="{$visit.info.format}"/>
			</p>
			<p>
				<label>涉及数量：</label>
				<input name="b[number]" type="text" size="30" errormsg="请输入涉及数量" value="{$visit.info.number}"/>
			</p>
			<p>
				<label>涉及批号：</label>
				<input name="b[betch]" type="text" size="30" errormsg="请输入涉及批号" value="{$visit.info.betch}"/>
			</p>
			<p>
				<label>问题发生日预判：</label>
				<input type="text" name="b[occur_date]" class="date required" errormsg="请输入问题发生日预判" size="30" dateFmt="yyyy-MM-dd HH:mm:ss" readonly="true" value="{$visit.info.occur_date}"/><a class="inputDateButton" href="javascript:;">选择</a>
			</p>
			<p>
				<label>问题提出人姓名：</label>
				<input name="b[person_name]" type="text" size="30" class="required" errormsg="请输入问题提出人姓名" value="{$visit.info.person_name}"/>
			</p>
			<p>
				<label>问题提出人职务：</label>
				<input name="b[person_study]" type="text" size="30" class="required" errormsg="请输入问题提出人职务" value="{$visit.info.person_study}"/>
			</p>
			<p>
				<label>问题提出人电话：</label>
				<input name="b[person_tel]" type="text" size="30" class="required" errormsg="请输入问题提出人电话" value="{$visit.info.person_tel}"/>
			</p>

			<div class="divider"></div>
			<div class="btn unit">
				<label>添加问题：</label>
				<a class="buttonActive" href="javascript:add_question();"><span>添加</span></a>
			</div>
			{foreach item=item key=key from=$visit.question}
			<div class="question unit">
				<label>问题简称：</label>
				<input name="c[question][]" type="text" size="30" value="{$item.question}"/>
				<span onclick="del_question(this)" style="cursor: pointer; color: red; margin-left: 10px; width: 50px; float: left;" alt="删除" title="删除">[ 删除 ]</span>
			</div>
			<div class="question unit">
				<label>问题描述：</label>
				<textarea name="c[question_desc][]" rows="10" cols="100">{$item.question_desc}</textarea>
			</div>
			{/foreach}
		</div>
		

		<div class="formBar">
			<ul>
				<li><div class="buttonActive"><div class="buttonContent"><button type="submit">提交</button></div></div></li>
				<li><div class="button"><div class="buttonContent"><button type="button" class="close">取消</button></div></div></li>
			</ul>
		</div>

	</form>

</div>

<script type="text/javascript">
var qoestion_num = <?php echo count($this->_var['visit']['question']); ?>;
$(function(){
	if(qoestion_num >= 3){
		$(".btn .buttonActive").attr("class","buttonDisabled");
	}
});
function add_question(){
	if(qoestion_num >= 3){
		
		return false;
	}
	qoestion_num += 1;
	if(qoestion_num == 3){
		$(".btn .buttonActive").attr("class","buttonDisabled");
	}
	var param = {type:""};
	param.type = "POST";
	param.url = "/index.php?act=visitafter&st=question";
	param.data = {num:qoestion_num};
	param.cache = false;
	param.error = function(){
		alert("未知错误");
	};
	param.success = function(data){
		$(".pageFormContent").append(data);
	}
	$.ajax(param);
}
function del_question(obj){
	var current = $(obj).parent(".question");
	current.next(".question").remove();
	current.remove();
	qoestion_num -= 1;
	qoestion_num = qoestion_num < 0?0:qoestion_num;
	if(qoestion_num < 3){
		$(".btn .buttonDisabled").attr("class","buttonActive");
	}
}
</script>